﻿

using Prism.Commands;
using Prism.Ioc;
using Prism.Services.Dialogs;

namespace DualPlaneFR4Paster.ViewModels.Dialogs.PartNum
{
    public class AddNewPartNumDialogViewModel : DialogViewModel
    {
        #region 变量

        #endregion
        #region 属性绑定
        private string newPartNumName;
        public string NewPartNumName
        {
            get { return newPartNumName; }
            set { SetProperty(ref newPartNumName, value); }
        }
        #endregion
        #region 命令绑定
        private DelegateCommand<object> addNewPartNumCommand;
        public DelegateCommand<object> AddNewPartNumCommand =>
            addNewPartNumCommand ?? (addNewPartNumCommand = new DelegateCommand<object>(ExecuteAddNewPartNumCommand));

        void ExecuteAddNewPartNumCommand(object obj)
        {
            switch (obj.ToString())
            {
                case "确认":
                    DialogParameters param = new DialogParameters();
                    param.Add("NewPartNumName", NewPartNumName);
                    OnRequestClose(new DialogResult(ButtonResult.Yes, param));
                    break;
                case "取消":
                    OnRequestClose(new DialogResult(ButtonResult.Cancel));
                    break;
                default:
                    break;
            }
        }

        #endregion
        public AddNewPartNumDialogViewModel(IContainerProvider containerProvider) : base(containerProvider)
        {
            NewPartNumName = string.Empty;
        }
    }
}
